import 'package:flutter/material.dart';

void main() => runApp(SecondPage());

class SecondPage extends StatelessWidget {
  SecondPage({
    Key key,
    @required this.text, // 接收一个text参数
  }) : super(key: key);
  final String text;

  @override
   build(BuildContext context) {
    return MaterialApp(
      title: text,
      debugShowCheckedModeBanner: false,
      home: new SecondStatefulWidget(),
    );
  }
}

class SecondStatefulWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new SecondPageState();
  }
}

class SecondPageState extends State {

  @override
   build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: GestureDetector(
          child: Text("返回"),
          onTap: (){
            Navigator.pop(context,"返回值");
          },
        ),
      ),
    );
  }
}
